package com.idanchuang.component.shadow.route.common.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * Shadow Routing Context
 *
 * @author Raistlin
 */
public class ShadowRouteContext {

    private static final ThreadLocal<String> routingKey = new TransmittableThreadLocal<>();

    /**
     * Get Routing Key
     *
     * @return
     */
    public static String getRoutingKey() {
        return routingKey.get();
    }

    /**
     * Set Routing Key
     */
    public static void setRoutingKey(String key) {
        routingKey.set(key);
    }

    /**
     * Reset Routing Key
     */
    public static void reset() {
        routingKey.remove();
    }

}
